home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / rwvector.lha / RWVector2.1 / src / xgemat.cc < prev    next >
C/C++ Source or Header  |  1989-08-18  |  2KB  |  103 lines

  1. /*
  2.  *    Definitions for <A>GEMatrix
  3.  *
  4.  *    Copyright (C) 1988, 1989.
  5.  *
  6.  *    Dr. Thomas Keffer
  7.  *    Rogue Wave Associates
  8.  *    P.O. Box 85341
  9.  *    Seattle WA 98145-1341
  10.  *
  11.  *    Permission to use, copy, modify, and distribute this
  12.  *    software and its documentation for any purpose and
  13.  *    without fee is hereby granted, provided that the
  14.  *    above copyright notice appear in all copies and that
  15.  *    both that copyright notice and this permission notice
  16.  *    appear in supporting documentation.
  17.  *    
  18.  *    This software is provided "as is" without any
  19.  *    expressed or implied warranty.
  20.  *
  21.  *
  22.  *    @(#)xgemat.cc    2.1    8/18/89
  23.  */
  24.  
  25. #define NO_VECTOR_MATHFUN
  26. #include "rw/<A>GEMatrix.h"
  27.  
  28. <A>GEMatrix::<A>GEMatrix() :
  29.     ()
  30. {
  31.   nrows = 0;
  32.   ncols = 0;
  33. }
  34.  
  35. <A>GEMatrix::<A>GEMatrix(int rows, int cols) :
  36.     (rows*cols)
  37. {
  38.   nrows = rows;
  39.   ncols = cols;
  40. }
  41.  
  42. <A>GEMatrix::<A>GEMatrix(int rows, int cols, <T> initval) :
  43.     (rows*cols, initval)
  44. {
  45.   nrows = rows;
  46.   ncols = cols;
  47. }
  48.  
  49. <A>GEMatrix::<A>GEMatrix(const <A>GEMatrix& m) :
  50.     (*(<T>Vec*)&m)        // Cast necessary for g++ bug
  51. {
  52.   nrows = m.nrows;
  53.   ncols = m.ncols;
  54. }
  55.  
  56. <A>GEMatrix::<A>GEMatrix(const <T>* v, int rows, int cols) :
  57.     (v, rows*cols)
  58. {
  59.   nrows = rows;
  60.   ncols = cols;
  61. }
  62.  
  63. <A>GEMatrix::<A>GEMatrix(const <T>Vec& v, int rows, int cols) :
  64.     (v)
  65. {
  66.   nrows = rows;
  67.   ncols = cols;
  68.   assertLength(v);
  69. }
  70.  
  71. <A>GEMatrix&
  72. <A>GEMatrix::operator=(const <A>GEMatrix& m)
  73. {
  74.   // Copy the base class over:
  75.   <T>Vec::operator=(m);
  76.   nrows = m.nrows;
  77.   ncols = m.ncols;
  78.   return *this;
  79. }
  80.  
  81. <A>GEMatrix&
  82. <A>GEMatrix::operator=(<T> s)
  83. {
  84.   // Copy the base class over:
  85.   <T>Vec::operator=(s);
  86.   return *this;
  87. }
  88.  
  89. <A>GEMatrix&
  90. <A>GEMatrix::reference(<A>GEMatrix& m)
  91. {
  92.   <T>Vec::reference(m);
  93.   nrows = m.nrows;
  94.   ncols = m.ncols;
  95.   return *this;
  96. }
  97.  
  98. <A>GEMatrix
  99. <A>GEMatrix::deepCopy()
  100. {
  101.   return <A>GEMatrix(<T>Vec::deepCopy(), nrows, ncols);
  102. }
  103.